{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "39854ebd-3273-458b-9481-4a0fe992bf22",
   "metadata": {},
   "outputs": [],
   "source": [
    "pip install openai"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d5e8a185-7140-487f-aa8d-30a26a065aa1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from dotenv import load_dotenv\n",
    "\n",
    "\"\"\"\n",
    "config 模块负责加载和管理应用的配置。\n",
    "它从 .env 文件和环境变量中读取配置，并提供一个统一的配置对象。\n",
    "这个模块集中了所有的配置管理，使得配置的修改和维护更加容易。\n",
    "\"\"\"\n",
    "\n",
    "def load_config():\n",
    "    \"\"\"\n",
    "    加载配置\n",
    "    :return: 包含所有配置项的字典\n",
    "    \"\"\"\n",
    "    # 加载 .env 文件中的环境变量\n",
    "    load_dotenv()\n",
    "\n",
    "    return {\n",
    "        # DashScope 相关配置\n",
    "        \"dashscope_api_key\": os.getenv(\"DASHSCOPE_API_KEY\"),\n",
    "        \"base_url\": \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n",
    "        \n",
    "        # 其他配置项\n",
    "        \"github_token\": os.getenv(\"GITHUB_TOKEN\"),\n",
    "        \"github_repo\": {\n",
    "            \"owner\": os.getenv(\"GITHUB_REPO_OWNER\"),\n",
    "            \"repo\": os.getenv(\"GITHUB_REPO_NAME\"),\n",
    "        },\n",
    "        # 可以根据需要添加更多配置项\n",
    "    }\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
